package com.rybbaby.tss.front.tssTransitionFeesSet.dao.imp;

import com.rybbaby.tss.core.web.dao.imp.GenericDao;
import com.rybbaby.tss.front.tssTransitionFeesSet.dao.ITssTransitionFeesSetDao;
import com.rybbaby.tss.front.tssTransitionFeesSet.entity.TssTransitionFeesSet;
import org.springframework.stereotype.Repository;

/**
 * @author 雷春琼
 * @description 过渡收费设置数据库操作实现
 * @createDate 2017-08-10 上午12:43:26
 */
@Repository
public class TssTransitionFeesSetDaoImp extends GenericDao<TssTransitionFeesSet> implements ITssTransitionFeesSetDao {

    /**
     * 根据状态来修改过渡收费信息
     *
     * @param targetDateId
     * @param isBlockUp
     * @return
     */
    @Override
    public Integer updateTransitionFeeSetByIsBlockUp(String targetDateId, Boolean isBlockUp) {
        String sql="update tss_transition_fees_set set updateTime=Now(),isBlockUp=? where id=?";
        return this.executeSql(sql, new Object[]{isBlockUp, targetDateId});
    }

    /**
     * 根据状态来修改过渡收费信息
     *
     * @param targetDateId
     * @param isBlockUp
     * @return
     */
    @Override
    public Integer updateTransitionsFeeSetByIsBlockUp(String targetDateId, Boolean isBlockUp) {
        String sql="update tss_transition_fees_set set updateTime=Now(),isBlockUp=? where id not in (?)";
        if(isBlockUp==false){
            return this.executeSql(sql, new Object[]{isBlockUp, targetDateId});
        }else{
            return this.executeSql(sql, new Object[]{!isBlockUp, targetDateId});
        }

    }

}